<template>
  <button
    :disabled="disabled || loading"
    :autofocus="autofocus"
    :type="nativeType"
    @click="$emit('click', $event)"
    :class="[
      'el-button',
      `el-button--${type ? type : 'default'}`,
      size && `el-button--${size}`,
      {
        'is-plain': plain,
        'is-round': round,
        'is-circle': circle,
        'is-disabled': disabled,
        'is-loading': loading
      },
    ]"
  >
    <i v-if="icon && !loading" :class="icon"></i>
    <i v-if="loading" class="el-icon-loading"></i>
    <span v-if="$slots.default">
      <slot />
    </span>
  </button>
</template>
<script>
export default {
  name: "ElButton",
  props: {
    type: {
      type: String,
      // default: 'default'
    },
    plain: {
      type: Boolean,
      default: false,
    },
    round: {
      type: Boolean,
      default: false,
    },
    circle: {
      type: Boolean,
      default: false,
    },
    icon: String,
    disabled: {
      type: Boolean,
      default: false,
    },
    loading: {
      type: Boolean,
      default: false,
    },
    size: String,
    autofocus: {
      type: Boolean,
      default: false,
    },
    nativeType: {
      type: String,
      default: 'button'
    }
  },
  created() {
    // console.log(this.$slots)
  },
};
</script>